home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / cvt100.zip / CVT100.DOC < prev    next >
Text File  |  1988-08-06  |  17KB  |  727 lines

  1.  
  2.                      CVT100, Terminal Emulator for Turbo C
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                  VT100, A Simple VT100 Emulator in Turbo C 1.5
  25.                         By Jerry Joplin CIS [70441,2627]
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                      CVT100, Terminal Emulator for Turbo C
  69.  
  70.  
  71.                                     Overview
  72.  
  73.  
  74.               CVT100 is a simple VT100 emulator programed exclusively
  75.          in Turbo C 1.5.   *All* of the code is in Turbo C.  There are
  76.          no assembler routines or functions requiring an assembler.
  77.          All of the code is contained in 7 modules.  These are:
  78.  
  79.               comio.c       communications functions
  80.               cvt100.c      terminal emulator main
  81.               fileio.c      file manipulation functions
  82.               keyio.c       keyboard functions
  83.               vidio.c       video functions
  84.               vtsetup.c     setup functions
  85.               vttio.c       terminal output interpretation functions
  86.  
  87.          The program was designed with several objectives in mind.
  88.  
  89.               1)  To provide a public domain source for a VT100
  90.                   emulator written in Turbo C code that was easy to
  91.                   understand and modify,
  92.  
  93.               2)  To show the power and flexibility of Turbo C without
  94.                   having to resort to assembly language routines,
  95.  
  96.               3)  To aid (however slightly) in the development of a C
  97.                   version of Kermit for MS DOS systems,
  98.  
  99.               4)  To provide a terminal emulator that takes a very
  100.                   small amount of memory and is capable of running in
  101.                   a well behaved window in Windows or DesqView (less
  102.                   than 40k).
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                      CVT100, Terminal Emulator for Turbo C
  135.  
  136.  
  137.                                    Operation
  138.  
  139.               The terminal emulator is menu driven.  The top line of
  140.          the terminal screen is reserved as a status line.  A list of
  141.          choices is displayed on the status line for setting the
  142.          various parameters concerning the different aspects of the
  143.          programs operation.
  144.  
  145.               Function Key F5:  This activates the Communications menu
  146.                                 setup. Here the COM port is
  147.                                 established along with its associated
  148.                                 baud rate, parity, data bits
  149.                                 and stop bits.
  150.  
  151.  
  152.               Function Key F6:  This key will activate the Video setup
  153.                                 menu.  Here the screen colors can be
  154.                                 set and the "snow" inhibit mode can be
  155.                                 set.
  156.  
  157.               Function Key F7:  This key when pressed enters the
  158.                                 keyboard setup menu.  Here the
  159.                                 program's interpretation of the
  160.                                 backspace key can be set.  The
  161.                                 keyboard can be programed to produce a
  162.                                 'key-click' and the state of the
  163.                                 keypad can be defined.
  164.  
  165.               Function Key F8:  An Emulation menu becomes active when
  166.                                 F8 is pressed.  Here the many mode
  167.                                 settings for the emulator may be set.
  168.                                 These include origin mode,
  169.                                 insert/replace mode, auto wrap mode,
  170.                                 new line mode, cursor visibility,
  171.                                 background video attributes and the
  172.                                 logical screen width.
  173.  
  174.               Function Key F9:  Function key F9 brings up a File menu.
  175.                                 The current settings for the terminal
  176.                                 can be saved in an initialization file
  177.                                 that is read when the program is
  178.                                 started.  Also a log of incoming
  179.                                 characters can be controlled.
  180.  
  181.               Function Key F10: This is used as the exit key.  When
  182.                                 pressed this will close any open log
  183.                                 files and exit.
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                      CVT100, Terminal Emulator for Turbo C
  201.  
  202.  
  203.                                  Communications
  204.  
  205.               Characters are received via receiver interrupts
  206.          generated by the UART.  The interrupt service routine (ISR)
  207.          for the incoming characters is a function of type interrupt
  208.          for Turbo C.  Although any serious communications program
  209.          should have the transmission interrupts in assembler, this
  210.          program has been tested at 19,200 baud on a plain vanilla
  211.          4.77 Mghz PC with no loss of characters.
  212.  
  213.               An XON/XOFF 'handshake' is used to control the flow of
  214.          characters to and from the host.  An XOFF is transmitted to
  215.          the host when 75% of the communications circular buffer is
  216.          full.  This will tell the host to stop transmitting
  217.          characters until an XON is transmitted to it.  When the
  218.          buffer is back down to 25% full an XON will be sent to the
  219.          host signaling it that it is okay to begin transmission
  220.          again.
  221.  
  222.               When an XOFF has been received from the host this
  223.          program will delay for a short period of time before sending
  224.          a character to check for an XON being sent.  Note that the
  225.          character will still be transmitted if the wait period passes
  226.          with no XON being received.
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                      CVT100, Terminal Emulator for Turbo C
  267.  
  268.  
  269.                                      Video
  270.  
  271.               Most video manipulations are done by reading and writing
  272.          directly to the screen's memory.   This made it necessary to
  273.          provide "snow" protection on CGA systems, but much less time
  274.          is wasted on writing characters and attributes than using the
  275.          BIOS.
  276.  
  277.               A check is done before each video memory access to
  278.          detect a control program such as Windows, DesqView, or
  279.          TopView.   Each of these control programs will keep a video
  280.          "shadow" buffer for processes currently executing.  The
  281.          address of this buffer can be queried and output directed to
  282.          this buffer instead of the actual screen.  This will let
  283.          CVT100 run in a well behaved window in these environments.
  284.  
  285.               There are several problems with the video system. A few
  286.          of the colors (Yellow foreground) do not work properly with
  287.          the emulation.  The program tries to juggle various
  288.          attributes defined by the host's control commands and tends
  289.          to lose the defined color in the process.  Also changing the
  290.          screen foreground and background colors may or may not work
  291.          during program execution.  This is due to the fact that the
  292.          software tries to retain the contents of the terminal screen
  293.          while making the color changes and again may get confused by
  294.          defined attributes.  To get around this problem, exit the
  295.          emulator and re-execute it.  The new colors will take effect
  296.          properly upon video initialization.
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                      CVT100, Terminal Emulator for Turbo C
  333.  
  334.  
  335.                                     Keyboard
  336.  
  337.               The most controversial part of any terminal emulator
  338.          will usually be the setup of the IBM PC keyboard to try and
  339.          match the Digital Equipment Corporation VT keypad.  Not an
  340.          easy task.  This program tries to map as closely as possible
  341.          the keypad for an IBM PC to a DEC VT keypad.   The results
  342.          a